1. Field of the Invention
The present invention relates to a method of image processing in an optical measuring apparatus using an optical cutting method.
2. Description of Related Art
This kind of optical measuring apparatus comprises, as shown in FIG. 1A, a projector 1 which is made up of a slit laser or the like for radiating a slit light on a workpiece A and an image sensing device 2 which is made up of a CCD camera or the like for picturing that optical cutting image or optical cross-sectional image s of the workpiece A which is the image of the slit light formed on the surface of the workpiece A. The projector 1 and the image sensing device 2 are arranged in such a positional relationship that an optical axis of the projector 2 slantingly crosses a light plane of the slit light.
When the workpiece A is of a doglegged shape (i.e., is bent at an angle) in cross section as shown in FIG. 1A, there will appear on a screen of the image sensing device 2 a pictured optical cutting image which has a maximum portion in the direction of one of the coordinate axes on the screen, e.g., in the X-axis direction.
In this case, if the maximum portion is provided with a corner so that a maximum point (or a tip) can be clearly recognized, the shape and the position of the workpiece can be measured based on this maximum point. However, if the maximum portion is round in shape, it is difficult to unambiguously determine the maximum point. In such a case, the following procedure has been considered. Namely, equations of lines to represent those portions of the pictured optical cutting image which are positioned on both sides, in the Y-axis direction, of the maximum portion are calculated. The position of the crossing point of the line on one side and the line on the other side, in the Y-axis direction, of the optical cutting image relative to the maximum portion is obtained from both the equations. The measurement of the workpiece is carried out by making this crossing point to serve as an alternative to the maximum point.
By the way, the pictured optical cutting image becomes a band-like image which has a certain width. Therefore, when the equations of the line on one side and of the line on the other side, in the Y-axis direction, of the image portion are calculated, the following procedure will be followed. Namely, a plurality of windows are set on the image portion, and the position of center of gravity of image in each of these windows is measured to thereby calculate an equation of a curved line or a straight line which passes through these centers of gravity of image. This procedure has, however, the following disadvantage. Namely, when the position of the workpiece changes relative to the optical measuring apparatus, the position of the pictured optical cutting image on the screen also changes. Therefore, if the windows are set in a certain fixed position of the screen, the windows may be placed away from the pictured optical cutting image, or the positions of setting the windows relative to the pictured optical cutting image may deviate from workpiece to workpiece. It is therefore necessary to displace also the position of setting the windows depending on the displacement of the pictured optical cutting image.
As a method of image processing to cope with this kind of requirement, there has hitherto been known one as described in Japanese Published Unexamined Patent Application No. 67200/1993 (corresponding to U.S. Pat. No. 5,311,289).
An explanation will now be made about the method of image processing as described in the above Patent Application based on an example in which a pictured optical cutting image has a maximum portion in the X-axis direction which is one of the coordinate axes of the screen. In this method, before setting predetermined windows respectively in one side portion and in the other side portion in the Y-axis direction relative to the maximum portion of the pictured optical cutting image, the position of a tip, in the X-axis direction, of the pictured optical cutting image is first measured. Then, at a position which is a predetermined length backwardly away from the tip in the X-axis direction, there are set two windows which are elongated in the Y-axis direction. According to this method, each of the windows falls in, or rests on, a predetermined portion of the pictured optical cutting image which extends towards one side and the other side in the Y-axis direction, while moving backwards away from the maximum portion in the X-axis direction. Then, the positions of the centers of gravity in both the windows are measured. A point which has a correlation with both the centers of gravity, e.g., a middle point of a line segment connecting both the centers of gravity is obtained as a reference point. A predetermined window is set respectively in one side portion and in the other side portion, in the Y-axis direction, of the pictured optical cutting image in a predetermined positional relationship with the reference point.
Here, the X-axis and the Y-axis coordinate values of the reference point come to almost accurately represent the displacements in the X-axis direction and in the Y-axis direction on the screen of the pictured optical cutting image. Therefore, even if the pictured optical cutting image may displace on the screen, each of the predetermined windows can be set in the one side portion and in the other side portion, in the Y-axis direction, of the pictured optical cutting image, in a constant positional relationship with these image portions based on the reference point. As a result, it becomes possible to calculate the equation of the image line on each side in the Y-axis direction at a higher accuracy based on the center of gravity in each of the predetermined windows. Based on that crossing point of both the image lines which is obtained by both the equations, the shape and the position of the workpiece can be accurately measured.
In case the workpiece A is a press-formed product (i.e., a product formed by pressing) which is doglegged in cross section as shown in FIG. 1A, the ridgeline of the workpiece A will be subjected to friction or rubbing by metallic molds and will therefore become mirror-finished or become as smooth as a mirror surface. As a result, there sometimes appears a pictured halation image H (or an image formed by halation) which is due to the reflected light from the ridgeline of the workpiece and which extends in the X-axis direction, in addition to the pictured doglegged optical cutting image S which has a maximum portion in the X-axis direction.
In case the workpiece A is S-shaped in cross section as shown in FIG. 2A, there will appear, as shown in FIG. 2B, not only an S-shaped pictured optical cutting image S having a maximum portion and a minimum portion in the X-axis direction, but also pictured reflected images R due to reflected images r of the optical cutting image S as reflected on the crossing planes on the bottom side of the workpiece A. Further, in case the workpiece A is a press-formed product, there may sometimes appear, as shown in FIG. 2C, a pictured halation image H in addition to the pictured reflected images R.
In the above-described conventional method of image processing, when this kind of pictured halation images or pictured reflected images appear, there are cases where the windows can no longer be set appropriately or where the centers of gravity of the pictured reflected images are detected as the centers of gravity of the images inside the windows. As a consequence, the image lines on both sides of the maximum portion of the pictured optical cutting image cannot be correctly calculated.
In view of the above-described points, the present invention has an object of providing a method of image processing in which the image lines on both sides of the maximum portion of the pictured optical cutting image can be correctly calculated even if there appear a halation image or reflected images.